﻿using System;
using System.Collections;

namespace GetPrimeFactor {
    class Program {
        static void GetPrimeFactor(int num, ArrayList factors) {
            int factor = 1;
            factors.Add(factor++);
            while (num > 1) {
                if (num % factor == 0) {
                    num /= factor;
                    factors.Add(factor);
                }
                else {
                    factor++;
                }
            }
        }
        static void Main(string[] args) {
            int inputNum = 0;
            ArrayList factors = new ArrayList();
            do {
                Console.WriteLine("Input(Positive Integer):");
                try {
                    inputNum = int.Parse(Console.ReadLine());
                }
                catch (Exception e) {
                    Console.WriteLine(e);
                }
            } while (inputNum <= 0);
            GetPrimeFactor(inputNum, factors);
            Console.WriteLine("Prime Factors:");
            foreach (int factor in factors) {
                Console.Write(factor + " ");
            }
            Console.WriteLine();
        }
    }
}
